package factory;

import factory.interfaceAndImplement.Circle;
import factory.interfaceAndImplement.Rectangle;
import factory.interfaceAndImplement.Shape;
import factory.interfaceAndImplement.Square;

public class ShapeFactory {

    //使用getShape方法获取形状类型的对象
    public Shape getShap(String shapeType) {
        if (shapeType == null) {
            return null;
        }
        if (shapeType.equalsIgnoreCase("CIRCLE")) {
            return new Circle();
        }
        if (shapeType.equalsIgnoreCase("RECTANGLE")) {
            return new Rectangle();
        }
        if (shapeType.equalsIgnoreCase("SQUARE")) {
            return new Square();
        }
        return null;
    }
}
